Sentry:An Introduction(Setting up Sentry)

Sentry:An Introduction(Setting up Sentry)

Clock Icon2023.07.03

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

What is Sentry

Introduction

Sentry is performance monitoring software. It is a popular open source tool that plays a vital role in monitoring, identifying, and resolving issues that arise during software production, development or any environment. In essence, Sentry is a crash reporting platform that provide real-time insight to help us address and resolve those crashes.

Sentry captures and notifies exceptions or errors that users encounter while using an app and organizes them on a web dashboard. The Reported exceptions include stack traces, device info, version and other relevant context automatically.

Distinguishing Sentry from logs

While both sentry and logs provide valuable Information about an application they serve different purposes. Logs provides valuable insights into the sequence of events, which are usually errors. However, Sentry takes a different approach by prioritising exceptions, effectively capturing real-time application crashes.Sentry does not catch all errors like logs do. Sentry doesn't retain complete details of every error that comes in if it's an error that already exists. As a result, Sentry cannot guarantee precise tracing back to a specific past error.

Implementing Sentry for browser in our Project:

Set up the Sentry SDK to receive reports of exceptions and errors from our application.

Sentry setup:

  • Start by creating a Sentry project.

  • Follow the instructions in the above picture to configure the React SDK as instructed by Sentry.
    • Install the SDK using a package manager.
      • yarn add @sentry/browser
    • Copy the configuration code provided and paste it in main.tsx.
      • import * as Sentry from "@sentry/react";
      • Sentry.init({
        //Sentry Configure code as instructed by the sentry.
        });
    • Verifying the Sentry.
      • Throw an error intentionally to test if Sentry can catch it.
        • throw new Error("Application Crashing");
      • Run the application by executing the command.
        • yarn run dev

Result:

Click on the issues in the Sentry dashboard to see the detailed error. This will confirm that Sentry is working effectively.

 

In conclusion, Sentry is a powerful tool for monitoring and managing software errors, offering real-time tracking, performance monitoring, and seamless integrations to enhance software quality and deliver exceptional user experiences.

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.